function oBlur_1() {
    let a = document.getElementById("blacklistName").value;
    if (a == "") {
        document.getElementById("remind_1").innerHTML = "黑名单不能为空！".fontcolor("red");
        document.getElementById("change_margin_1").style.marginBottom = 1 + "px";
    } else {
        document.getElementById("remind_1").innerHTML = "";
        document.getElementById("change_margin_1").style.marginBottom = 19 + "px";
    }
}

function oFocus_1() {
    document.getElementById("remind_1").innerHTML = "";
    document.getElementById("change_margin_1").style.marginBottom = 19 + "px";
}



window.onload = function(){

    var index = parent.layer.getFrameIndex(window.name);

    $('#saveSoftware').click(function () {
        var blacklistName = $("#blacklistName").val();
        var blacklistValid = $("#blacklistValid").val();
        
        if(blacklistName==""||blacklistValid==""){
            parent.layer.confirm('关键信息未全，不能添加！',{btn:['确定']});
        }else {
        	var url ="";
        	var id = $("#id").val();
//        	alert(id);
        	if(id == null || id==""){
        		url= constUrl + "ws/remote/blacklist/add.action";
        	}else{
        		url= constUrl + "ws/remote/blacklist/update.action";
        			}
//        	alert(url);
        	
        	$.ajax({
                url: url,
                type: 'post',
                data: {
                		id:id,
                    appName: blacklistName,
                    valid: blacklistValid
                },
                dataType: 'json',
                success: function (dataText) {
                	console.log(dataText);
                    if (dataText.desc=="SUCCESS") {
                        parent.layer.confirm('操作成功！', {
                            btn: ['确定']
                        }, function () {
                            parent.location.reload(index);
                            parent.layer.close(index);
                        });
//                        parent.layer.close(index);
                    }
                },

                complete: function () {
                },
                error: function () {

                }
            });
        }
    });

    $('#closeIframe').click(function(){
        parent.layer.close(index);
    });
}

